package com.da.javatest.jvm;

public abstract class Passenger {
    // java -XX:CompileCommand='dontinline,*.exit' Passenger
    abstract void exit();

    public static void main(String[] args) {
        Passenger a = new Chinese();
        Passenger b = new Foreigners();
        long current = System.currentTimeMillis();
        for (int i = 1; i <= 2_000_000_000; i++) {
            if (i % 100_000_000 == 0) {
                long temp = System.currentTimeMillis();
                System.out.println(temp - current);
                current = temp;
            }
            Passenger c = (i < 1_000_000_000) ? a : b;
            c.exit();
        }
    }
}

class Chinese extends Passenger {
    @Override
    void exit() {}
}

class Foreigners extends Passenger {
    @Override
    void exit() {}
}
